#include <iostream>
using namespace std;
class Base{
public:
    Base(){
        cout<<"Base"<<endl;
    }
    virtual void method(){}
    ~Base(){
        cout<<"DeleteBase"<<endl;
    }
};
class Source:public Base{
public:
    void method(){
        cout<<"MethodRun"<<endl;
    }
    ~Source(){
        cout<<"DeleteSource"<<endl;
    }

};
class Proxy:public Base{
private:
    Base * pb;
public:
    Proxy(){
        pb=NULL;
    }
    Proxy(Base * t){
        pb=t;
    }
    void method(){
        pb->method();
    }
    ~Proxy(){
        cout<<"DeleteProxy"<<endl;
        delete pb;
    }
};
int main() {
    Proxy * proxy = new Proxy(new Source);
    proxy->method();
    delete(proxy);
}